<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

	<ui:composition template="template.xhtml">
	
		<ui:define name="titre">Nouvel contact</ui:define>
	
		<ui:define name="contenu">
			<h:form>
				<p:growl id="growl" />
	
				<p:panel id="pnl" header="Creer un nouvel contact" style="margin-bottom:10px;">
					<p:messages id="messages" />
					<h:panelGrid columns="3" colspan="7">
						<h:outputLabel for="nom" value="Nom: *" />
						<p:inputText id="nom" value="#{contactBean.contact.nom}"
							required="true" label="Nom">
							<f:validateLength minimum="2" />
						</p:inputText>
						<p:message for="nom" />
	
						<h:outputLabel for="prenom" value="Prenom: *" />
						<p:inputText id="prenom" value="#{contactBean.contact.prenom}"
							required="true" label="prenom" >
							<f:validateLength minimum="2" />
						</p:inputText>
						<p:message for="prenom" />
	
						<h:outputLabel for="email" value="Email: *" />
						<p:inputText id="email" value="#{contactBean.contact.email}"
							required="true" label="email" >
							<!-- TODO mettre en place une regex -->
							<f:validateLength minimum="2" />
						</p:inputText>
						<p:message for="email" />
	
						<h:outputLabel for="pass" value="Mot de Passe: *" />
						<p:inputText id="pass" value="#{contactBean.contact.motDePasse}"
							required="true" label="pass" >
							<!-- TODO mettre en place une regex -->
							<f:validateLength minimum="6" />
						</p:inputText>
						<p:message for="pass" />
	
						<h:outputLabel for="phone" value="Telephone: *" />
						<p:inputText id="phone" value="#{contactBean.contact.telephone}"
							required="true" label="phone" >
							<f:validateLength minimum="10" />
						</p:inputText>
						<p:message for="phone" />
					</h:panelGrid>
	
					<p:commandButton id="saveBtn" value="Enregistrer" icon="ui-icon-check"
						style="margin:0" actionListener="#{contactBean.valider}"
						update="growl" />
				</p:panel>
			</h:form>
		</ui:define>
	</ui:composition>
</html>